package com.novaed.game.frames;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import com.novaed.game.backend.ImagePanel;

@SuppressWarnings("serial")
public class Dialog extends JFrame {

	private static String u_action;
	private static JButton u_button = new JButton();
	
	/** 
	 * Constructor
	 * @param String action
	 * <br /> Identifies the return <i>action</i> to the online user
	 * @param JButton button
	 * <br /> execute the identified action respective to the current executing class
	 * 
	 **/
	
	public Dialog(String action, JButton button) {
		
		JLabel lbl_Ask = new JLabel(action);
		JPanel pnl_Action = new JPanel();
		JPanel pnl_Button = new JPanel();
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 271, 162);
		setUndecorated(true);
		setVisible(true);
		setLocationRelativeTo(null);
		setAlwaysOnTop(true);
		
		pnl_Action = new ImagePanel("res/imgs/menu/bg_play.png");
		pnl_Action.setBorder(new EmptyBorder(5, 5, 5, 5));
		pnl_Action.setLayout(new BorderLayout(0, 0));
		
		lbl_Ask.setForeground(Color.WHITE);
		lbl_Ask.setHorizontalAlignment(SwingConstants.CENTER);
		
		pnl_Action.add(lbl_Ask, BorderLayout.CENTER);
		
		btn_YES = new JButton("Yes");
		btn_CANCEL = new JButton("No");
		pnl_Button.add(btn_YES);
		pnl_Button.add(btn_CANCEL);
		
		getContentPane().setLayout(new BorderLayout());
		getContentPane().add(pnl_Action, BorderLayout.CENTER);
		getContentPane().add(pnl_Button, BorderLayout.SOUTH);
		
		btn_YES.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
		
		
		btn_CANCEL.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		
	}
	
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Dialog frame = new Dialog(u_action, u_button);
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
	
	private JButton btn_YES = null;
	private JButton btn_CANCEL = null;
	
	private JButton btn_Fifty = null;
	private JButton btn_Turtle = null;
	private JButton btn_Switch = null;
	
}
